package com.customization.shunsheng;

import com.engine.core.cfg.annotation.CommandDynamicProxy;
import com.engine.core.interceptor.AbstractCommandProxy;
import com.engine.core.interceptor.Command;
import com.engine.kq.cmd.report.GetSearchConditionCmd;
import weaver.general.Util;

import java.util.List;
import java.util.Map;

@CommandDynamicProxy(target = GetSearchConditionCmd.class )
public class GetSearchConditionCmdIntercept extends AbstractCommandProxy<Map<String,Object>> {

    @Override
    public Map<String, Object> execute(Command<Map<String, Object>> command) {
        GetSearchConditionCmd cmd = (GetSearchConditionCmd) command;
        Map<String,Object> params=cmd.getParams();
        Map<String,Object> result=nextExecute(cmd);

        String reportType = Util.null2String(params.get("reportType"));
        if ("daily".equals(reportType)){
            List<Object> showColumns = (List<Object>) result.get("showColumns");
            List<Object> showColumns1 = (List<Object>) showColumns.get(0);
            showColumns1.remove(0);
            showColumns1.remove(0);
            showColumns1.remove(0);
            showColumns1.remove(0);
            showColumns1.remove(0);
            showColumns1.remove(0);
        }
        return result;
    }
}
